---
layout: example.html
title: Vector Label Decluttering
shortdesc: Label decluttering with a custom renderer.
resources:
  - https://cdn.polyfill.io/v2/polyfill.min.js?features=Set"
  - https://unpkg.com/rbush@2.0.1/rbush.min.js
  - https://unpkg.com/labelgun@0.1.1/lib/labelgun.min.js
docs: >
  A custom `renderer` function is used instead of an `ol.style.Text` to label the countries of the world. Only texts that are not wider than their country's bounding box are considered and handed over to [Labelgun](https://github.com/Geovation/labelgun) for decluttering.
tags: "vector, renderer, labelgun, label"
---
<div id="map" class="map"></div>
